MAX = 100000
isp = [1 for i in xrange(MAX)]
isp[0] = isp[1] = 0
p = []
for i in xrange(2, MAX):
    if isp[i]:
        p.append(i)
        for j in xrange(i + i, MAX, i):
            isp[j] = 0

for i in xrange(35, MAX, 2):
    found = 1
    for j in xrange(0, MAX):
        if i - 2 * j * j > 0:
            k = i - 2 * j* j
            if isp[k]:
                found = 0
                break
        else:
            break
    if found:
        print i
        break



